package com.example.imtoken.modules.main.wallet.details.trade.transfer.set_price

import android.os.Bundle
import androidx.recyclerview.widget.DiffUtil
import com.example.imtoken.entitys.http.Step

class SettingMinerDiffCallBack : DiffUtil.ItemCallback<Step>() {
    override fun areItemsTheSame(oldItem: Step, newItem: Step): Boolean {
        return oldItem.name == newItem.name
    }

    override fun areContentsTheSame(oldItem: Step, newItem: Step): Boolean {
        return oldItem.isSelected == newItem.isSelected
    }

    override fun getChangePayload(oldItem: Step, newItem: Step): Any? {
        val bundle = Bundle()
        if (oldItem.isSelected != newItem.isSelected) {
            bundle.putBoolean("isSelected", newItem.isSelected)
        } else {
            return null
        }
        return bundle
    }
}